#ifndef _HTTP_CONNECTION__H
#define _HTTP_CONNECTION__H

#include "networklib.h"
#include <http/http_request.hpp>
#include <http/http_response.hpp>
#include <list>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
using namespace std;

class HTTPConnection
{
private:
  int sock;
  int bytes;
  string ip;
  struct sockaddr_in server_addr_ipv4;
  struct sockaddr_in6 server_addr_ipv6;
  struct hostent server;
  static const int GET = 1;
  static const int POST = 2;
public:
  HTTPConnection();
  ~HTTPConnection();
  int create_http_connection(char* ip_addr, int port, int ip_version);
  void send_request(HTTPRequest );
  //  HTTPResponse get_response(int timeout);
  string get_response(int timeout);
};
#endif
